<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="com.wlcorp.forcazamis.sys.util.AppConstant" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="com.wlcorp.forcazamis.domain.baseinfo.SampleType" %>
<%@ page import="com.wlcorp.forcazamis.domain.baseinfo.Feature" %>
<%@ page import="com.wlcorp.forcazamis.domain.baseinfo.Factory" %>
<%
	List sampleTypeList = (List)request.getAttribute("sampleTypeList");
	List featureList = (List)request.getAttribute("featureList");
	List factoryList = (List)request.getAttribute("factoryList");
%>
<html>
<head>
	<title>样品检索</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-Control" content="no-cache"><meta http-equiv="Expires" content="0">
	<link href="${pageContext.request.contextPath}/css/css.css" rel=stylesheet>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/button_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/form_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/table_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/pagetitle_css.css" type="text/css">
	<script language="javascript" src="${pageContext.request.contextPath}/script/common.js"></script>
         <script language="javascript">
        	function queryData(){
                document.forms["sampleForm"].submit();
			}
			
			function doAddNew(){
				document.frames["sampleListFrame"].location = "${pageContext.request.contextPath}/sample/sampleManager.do?method=getSample";
			}
			
			function commonSearch(){
				document.forms["sampleForm"].style.visibility = "visible";
				document.forms["sampleForm"].style.display = "";
				
				document.forms["sampleDetailForm"].style.visibility = "hidden";
				document.forms["sampleDetailForm"].style.display = "none";
				var searchTypeArray = document.forms["sampleForm"].searchType;
				for(i = 0;i < searchTypeArray.length;i++){
					if(searchTypeArray[i].value == "1"){
						searchTypeArray[i].checked = true;
					}else{
						searchTypeArray[i].checked = false;
					}
				}
			}
			
			function highSearch(){
				document.forms["sampleForm"].style.visibility = "hidden";
				document.forms["sampleForm"].style.display = "none";
				
				document.forms["sampleDetailForm"].style.visibility = "visible";
				document.forms["sampleDetailForm"].style.display = "";
				var searchTypeArray = document.forms["sampleDetailForm"].searchType;
				for(i = 0;i < searchTypeArray.length;i++){
					if(searchTypeArray[i].value == "2"){
						searchTypeArray[i].checked = true;
					}else{
						searchTypeArray[i].checked = false;
					}
				}
			}
			
			function doHighSearch(){
				var form = document.forms["sampleDetailForm"];
				var sampleType = form.sampleType.value;
				var feature = form.feature.value;
				var factory = form.factory.value;
				var sampleCode = "";
				
				if(factory.length < 1){
					sampleCode = sampleCode + "_" + "%";
				}else{
					sampleCode = sampleCode + factory + "%";
				}
				
				if(sampleType.length < 1){
					sampleCode = sampleCode + "_";
				}else{
					sampleCode = sampleCode + sampleType;
				}
				
				if(feature.length < 1){
					sampleCode = sampleCode + "_";
				}else{
					sampleCode = sampleCode + feature;
				}
				
				
				if("_%__" == sampleCode){
					sampleCode = "";
				}
				form.sampleCode.value = sampleCode;
				
				form.submit();
			}
			
			function doCommonSearch(){
				document.forms["sampleForm"].submit();
			}

        </script>
</head>
<body bgcolor="#ffffff" onload="queryData()">
  		<table width="100%" border="0" cellspacing="0" cellpadding="0" height="30">
			<tr> 
		  		<td width="22" class="page_titlebar_head">&nbsp;</td>
		  		<td class="page_titlebar_bg" width="981">样品搜索</td>
			</tr>
	  	</table>
	  	<center>
	  	<form name="sampleForm" method="post" action="${pageContext.request.contextPath}/sample/sampleManager.do" target="sampleListFrame">
  		<input type="hidden" name="method" value="getSearchSampleList"/>
        <table width="90%" class="InputFrameMain" cellspacing="0" cellpadding="0" border="0" height="100">
          <tr> 
        	<td class="table_unfold_titlebar_small_bg" colspan="6">&nbsp;&nbsp;<b>查询类型选择 
        		<input type="radio" name="searchType" value="1" checked onclick="commonSearch()"/>普通检索&nbsp;
        		<input type="radio" name="searchType" value="2" onclick="highSearch()"/>高级检索&nbsp;
        		<input type="checkbox" name="displayImage" value="1"/>显示图片&nbsp;</b>
        	</td>
      	  </tr> 
          <tr class="InputFrameLine">
            <td class="table_label" width="15%">样品编号</td>
            <td width="18%">&nbsp;<input class="input" type="text" name="sampleCode" style="width:120px"/></td>
            <td class="table_label" width="15%">来源类型</td>
            <td width="18%">&nbsp;<select name="sourceType" style="width:100px">
            	<option value="">--全部--</option>
            	<option value="<%=AppConstant.SOURCE_TYPE_DEVELOPERCS%>">研发改样</option>
            	<option value="<%=AppConstant.SOURCE_DEVELOPERMD%>">研发模仿</option>
            	<option value="<%=AppConstant.SOURCE_DEVELOPEROR%>">研发原创</option>
            	<option value="<%=AppConstant.SOURCE_BUYS%>">直接买样</option>
            	<option value="<%=AppConstant.SOURCE_CUSTOMERS%>">客户来样</option>
            	<option value="<%=AppConstant.SOURCE_FACTORYS%>">工厂来样</option>
            	<option value="<%=AppConstant.SOURCE_OUTS%>">出货样</option>
            	<option value="<%=AppConstant.SOURCE_CHANGES%>">改款</option>
            </select>
            </td>
            <td class="table_label" width="15%"></td>
            <td width="18%">&nbsp;</td>
          </tr>
          <tr class="InputFrameLine">
            <td class="table_label" width="15%">来源编号</td>
            <td width="18%">&nbsp;<input class="input" type="text" name="sourceCode" style="width:120px"/></td>
            <td class="table_label" width="15%">工厂编号</td>
            <td width="18%">&nbsp;<input class="input" type="text" name="factoryCode" style="width:120px"/></td>
            <td class="table_label" width="15%"></td>
            <td width="18%">&nbsp;</td>
          </tr>
          <tr class="InputFrameLine">
            <td class="table_label" width="15%">来源1</td>
            <td width="18%">&nbsp;<input class="input" type="text" name="source1" style="width:120px"/></td>
            <td class="table_label" width="15%">来源2</td>
            <td width="18%">&nbsp;<input class="input" type="text" name="source2" style="width:120px"/></td>
            <td class="table_label" width="15%">来源3</td>
            <td width="18%">&nbsp;<input class="input" type="text" name="source3" style="width:120px"/></td>
          </tr>
          <tr class="InputFrameLine">
            <td width="100%" colspan="6" align="center"><input type="button" value="     查询" class="button_find" onclick="doCommonSearch()"/></td>
          </tr>
        </table>
  		</form>
  		<!-- 高级检索FORM -->
  		<form name="sampleDetailForm" method="post" action="${pageContext.request.contextPath}/sample/sampleManager.do" target="sampleListFrame" style="visibility:hidden;display:none;">
  		<input type="hidden" name="method" value="getSearchSampleList"/>
  		<input type="hidden" name="showImage"/>
  		<input class="input" type="hidden" name="sampleCode"/>
        <table width="90%" class="InputFrameMain" cellspacing="0" cellpadding="0" border="0" height="100">
          <tr> 
        	<td class="table_unfold_titlebar_small_bg" colspan="6">&nbsp;&nbsp;<b>查询类型选择 
        		<input type="radio" name="searchType" value="1" onclick="commonSearch()"/>普通检索&nbsp;
        		<input type="radio" name="searchType" value="2" checked onclick="highSearch()"/>高级检索&nbsp;
        		<input type="checkbox" name="displayImage" value="1"/>显示图片&nbsp;</b>
        	</td>
      	  </tr> 
          <tr class="InputFrameLine">
          	
            <td class="table_label" width="15%">公司型号</td>
            <td width="45%" colspan="3">&nbsp;<select name="factory" style="width:100px">
            	<option value="">--全部--</option>
            	<%
            		for(Iterator iter = factoryList.iterator();iter.hasNext();){
            			Factory factory = (Factory)iter.next();
            	%>
            	<option value="<%=factory.getFactoryCode()%>"><%=factory.getFactoryName()%>[<%=factory.getFactoryCode()%>]</option>
            	<%}%>
            </select>&nbsp;
            <select name="sampleType" style="width:100px">
            	<option value="">--全部--</option>
            	<%
            		for(Iterator iter = sampleTypeList.iterator();iter.hasNext();){
            			SampleType sampleType = (SampleType)iter.next();
            	%>
            	<option value="<%=sampleType.getSampleTypeCode()%>"><%=sampleType.getSampleTypeName()%>[<%=sampleType.getSampleTypeCode()%>]</option>
            	<%}%>
            </select>&nbsp;
            <select name="feature" style="width:100px">
            	<option value="">--全部--</option>
            	<%
            		for(Iterator iter = featureList.iterator();iter.hasNext();){
            			Feature feature = (Feature)iter.next();
            	%>
            	<option value="<%=feature.getFeatureCode()%>"><%=feature.getFeatureName()%>[<%=feature.getFeatureCode()%>]</option>
            	<%}%>
            </select>&nbsp;
            </td>
            <td class="table_label" width="15%">来源类型</td>
            <td width="35%">&nbsp;<select name="sourceType" style="width:100px">
            	<option value="">--全部--</option>
            	<option value="<%=AppConstant.SOURCE_TYPE_DEVELOPERCS%>">研发改样</option>
            	<option value="<%=AppConstant.SOURCE_DEVELOPERMD%>">研发模仿</option>
            	<option value="<%=AppConstant.SOURCE_DEVELOPEROR%>">研发原创</option>
            	<option value="<%=AppConstant.SOURCE_BUYS%>">直接买样</option>
            	<option value="<%=AppConstant.SOURCE_CUSTOMERS%>">客户来样</option>
            	<option value="<%=AppConstant.SOURCE_FACTORYS%>">工厂来样</option>
            	<option value="<%=AppConstant.SOURCE_OUTS%>">出货样</option>
            	<option value="<%=AppConstant.SOURCE_CHANGES%>">改款</option>
            </select>
            </td>
          </tr>
          <tr class="InputFrameLine">
            <td class="table_label" width="15%">来源1</td>
            <td width="18%">&nbsp;<input class="input" type="text" name="source1" style="width:120px"/></td>
            <td class="table_label" width="15%">来源2</td>
            <td width="18%">&nbsp;<input class="input" type="text" name="source2" style="width:120px"/></td>
            <td class="table_label" width="15%">来源3</td>
            <td width="18%">&nbsp;<input class="input" type="text" name="source3" style="width:120px"/></td>
          </tr>
          <tr class="InputFrameLine">
            <td width="100%" colspan="6" align="center"><input type="button" value="     查询" class="button_find" onclick="doHighSearch()"/></td>
          </tr>
        </table>
  		</form>
  		</center>
  <center>
  <iframe id="sampleListFrame" name="sampleListFrame" width="90%" frameborder="0" height="520px" scrolling="auto" src="" style="margin-top:-15px"></iframe>
  </center>
</body>
</html>
<jsp:include page="../footer.jsp"/>